if (!jsx3.lang.Class.forName("ux.cdb.admin.customer.cusBuilder.Builder")) {
/**
 * Define the <code>tibco.spm.design.rule.builder.Builder</code> class.
 * This class inherit from <code>jsx3.gui.Dialog<code> GUI class.
 */
jsx3.Class.defineClass(
		"ux.cdb.admin.customer.cusBuilder.Builder",
		jsx3.gui.Dialog,
		null,
		function (objRoot) {
			/**
			 * This method will be called after UI file has deserialized.
			 */
			objRoot.prototype.onAfterDeserialize = function() {
				this.wizard = this.get("steppedWizard");
/* @JSC :: begin DEBUG */
				jsx3.log('Customer#Builder#onAfterDeserialize load common code...');
/* @JSC :: end */
				ux.cdb.admin.CommonCache.loadCache(
					['DEGREE','GRADE_CODE','EDUCATION_SYS_CODE','ONSCHOOLING_STATUS',
					'PROVINCE','AGENT_BANK','ORG_PROPERTY', 'ANNUAL_INCOME'], this, function(){
/* @JSC :: begin DEBUG */
					jsx3.log('Customer#Builder#onAfterDeserialize common code cached.');
/* @JSC :: end */
				});				
			};
			
			objRoot.prototype.onClose = function() {
				var cacheId = ux.cdb.admin.dataautomate.GenericDetail.Student + ":" + this.studentId;
				ux.cdb.admin.Cache.remove(cacheId);
				this.doClose();
			};
			
			objRoot.prototype.saveBuilder = function() {
				//console.log("saveBuilder studyInfo", this.studyInfo);
				
				var result = false, curr, panel, tip, i;
				// step 4 career info does not need validation
				if(this.editMode == 'new') {
					for(i=1; i<=3; i++) {
	                    panel = this.get("wizPanel_" + i);
	                    if(panel.loaded && !panel.doValidation()) {
	                    	//alert("new validate " + i + " false");
	                        tip = ux.megatron.Main.getServer().getDynamicProperty("@cdb@cusbuilder@TipUnFinishedStep" + i);
	                        this.wizard.getMessageLabel().setText(tip);
	                        return;
	                    }
	                }
				} else {
	                for(i=1; i<=3; i++) {
	                    panel = this.get("wizPanel_" + i);
	                    if(panel.loaded && !panel.doValidation()) {
	                    	//alert("edit validate " + i + " false");
	                        tip = ux.megatron.Main.getServer().getDynamicProperty("@cdb@cusbuilder@TipUnFinishedStep" + i);
	                        this.wizard.getMessageLabel().setText(tip);
	                        return;
	                    }
	                }
              	}
                //return;

                if(ux.megatron.Main.isFileSystem()) {
                    this.closeBuilder();
                } else {
/* @JSC :: begin DEBUG */
                	jsx3.log('this.baseInfo : ' + dwr.util.toDescriptiveString(this.baseInfo, 5));
                	jsx3.log('this.accInfo' + dwr.util.toDescriptiveString(this.accInfo, 5));
                	jsx3.log('this.studyInfo' + dwr.util.toDescriptiveString(this.studyInfo, 5));
                 	jsx3.log('this.careerInfo' + dwr.util.toDescriptiveString(this.careerInfo, 5));
/* @JSC :: end */
					if(this.editMode == 'new') {
                		var me = this;
                		//console.log('save new: ', this);
                		ux.megatron.util.Dwr.callDwr("AddStudentInfoUCC", "saveAllStudentInfo", 
                        	[this.baseInfo, /* this.accInfo */null, this.studyInfo, null], this, function() {
                        	me.closeCreateDialog();
                    	});
                    	//this.closeCreateDialog();
                	} else {
                		var me = this;
                		ux.megatron.util.Dwr.callDwr("AddStudentInfoUCC", "saveAllStudentInfo", 
                        	[this.baseInfo, this.accInfo, this.studyInfo, this.careerInfo], this, function() {
                        	me.closeCreateDialog();
                    	});
                    	//this.onClose();
                	}
                }
			};
			
			objRoot.prototype.closeCreateDialog = function() {
				//refresh data of parent matrix.
				ux.megatron.Main.getServer().getBodyBlock().get("blkCustomer").doQuery(true);
				this.onClose();
				return;
				var me = this;
				var parent = ux.megatron.Main.getServer().getBodyBlock();
				ux.megatron.Main.loadUIResourceAsync(parent,"ux.cdb.admin","ux/cdb/admin/customer/cusBuilder/ui/confContinueDialog.xml",me, me.confirmDlgLoad);
			};
			
			objRoot.prototype.confirmDlgLoad = function (objEvent) {
				var confirmDlg = objEvent.obj;
				if(!confirmDlg.stuInfo)  {confirmDlg.stuInfo = {}; }
				confirmDlg.stuInfo.studentId = this.studyInfo.studentId;
				confirmDlg.stuInfo.studentName = this.baseInfo.chnFullName;
				confirmDlg.stuInfo.studentCertId = this.baseInfo.certId;
				//confirmDlg.stuInfo.comeFrom = 'customer';
			}
			
		});
}